package com.atguigu.gulimall.ware.service;

import com.atguigu.common.to.OrderTo;
import com.atguigu.common.vo.HasStockVo;
import com.atguigu.gulimall.ware.exception.NoStockException;
import com.atguigu.gulimall.ware.vo.LockStockRabbitMqVo;
import com.atguigu.gulimall.ware.vo.LockStockVo;
import com.atguigu.gulimall.ware.vo.OrderEntity;
import com.baomidou.mybatisplus.extension.service.IService;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.ware.entity.WareSkuEntity;
import com.rabbitmq.client.Channel;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author zhangjianyou
 * @email 1844897920@qq.com
 * @date 2022-06-01 16:14:21
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    PageUtils queryByCondition(Map<String, Object> params);

    void addToWare(Long skuId, Long wareId, Integer skuNum);

    List<HasStockVo> hasStock(List<Long> skuIds);

    List<HasStockVo> getHasStock(List<Long> skuIds);

    void lockStock(LockStockVo lockStockVo) throws NoStockException;

    void unLock(LockStockRabbitMqVo lockStockRabbitMqVo);

    void unLockStock(Long skuId, Integer skuNum, Long wareId, Long id);

    void unLock(OrderTo orderEntity);
}

